<template>
<div>
  <p v-for="grade in gradelist">
    <button @click="toStudent(grade.id)":value="grade.id">{{grade.name}}</button>=={{grade.count}}
  </p>
</div>
</template>

<script>
  import Studentlist from "./Studentlist";
    export default {
        name: "Gradelist",
      data(){
          return{
            gradelist:[],

          }
      },
      methods:{
          toStudent(grade_id){
            this.$router.push({
              name:'Studentlist',
              query:{
                grade_id:grade_id
              }
            })
          },
        getGrade(){
          this.$axios.get('app01/grade/')
            .then(res=>{
              console.log(res.data)
              this.gradelist=res.data
            })
        }
      },
      created() {
          this.getGrade()

      }
    }
</script>

<style scoped>

</style>
